package com.heima.ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.heima.ssm.dao.IProductDao;
import com.heima.ssm.pojo.Product;
import com.heima.ssm.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Penguin
 * @create Date 2021/4/30  Time 15:49
 */


@Service
@Transactional
public class ProductServiceImpl implements IProductService {

    @Autowired
    private IProductDao productDao;

    @Override
    public List<Product> findAll(int page,int pageSize) {
        PageHelper.startPage(page,pageSize);
        return productDao.findAll();
    }

    @Override
    public void save(Product product) {
        productDao.save(product);
    }
}
